Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #245, implement safer codec loops #254

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

jphickey
Copy link
Collaborator

Describe the contribution
Implement the encoding and decoding of CBOR containers as a loop. This permits the "error" flag to be easily polled after each iteration, and if it is ever set, the operation should exit safely.

This is important because after any encode/decode issue, the tiny CBOR state will no longer be in sync with the data, and this library may assert if invoked with a bad state object.

Fixes #245

Testing performed
Pass in unrecognized/non-conformant bundle and confirm decoding stops - no additional calls into TinyCBOR are made.

Expected behavior changes
No change of assertion inside TinyCBOR if called after codec state becomes invalid

System(s) tested on
Debian + TinyCBOR v0.60

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

Implement the encoding and decoding of CBOR containers as a loop.  This
permits the "error" flag to be easily polled after each iteration, and
if it is ever set, the operation should exit safely.

This is important because after any encode/decode issue, the tiny CBOR
state will no longer be in sync with the data, and this library may
assert if invoked with a bad state object.
@jphickey jphickey added ccb:ready Pull request is ready for CCB discussion ccb:approved Pull request has been granted final approval for merging. All required process objectives are met. and removed ccb:ready Pull request is ready for CCB discussion labels Sep 20, 2023
@jphickey jphickey merged commit 7f85ff5 into nasa:main Sep 27, 2023
8 checks passed
@jphickey
Copy link
Collaborator Author

Reviewed and approved at 2023-09-27 CCB

@jphickey jphickey deleted the fix-245-codec-pattern branch November 14, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ccb:approved Pull request has been granted final approval for merging. All required process objectives are met.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update decoding pattern to avoid possible assert in TinyCBOR
1 participant